<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>flex 换行自适应宽度</title>
</head>

<body>
    作者：黑马程序员前端
    链接：https://www.zhihu.com/question/580247017/answer/2881246305
    来源：知乎
    著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。
    <style>
        .container {
            display: flex;
            flex-wrap: wrap;
            flex-direction: row;
        }

        .item {
            flex-basis: 20%;
            background-color: palegoldenrod;
           
        }
    </style>

    <div class="container">
        <div class="item">Item 1</div>
        <div class="item">Item 2</div>
        <div class="item">Item 3</div>
        <div class="item">Item 4</div>
        <div class="item">Item 5</div>
    </div>


</body>

</html>